package com.xianzhi.service.impl;

import java.util.List;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xianzhi.bean.User;
import com.xianzhi.dao.UserDao;
import com.xianzhi.dto.UserDto;
import com.xianzhi.service.UserService;
@Service
public class UserServiceImpl implements UserService{
	@Autowired
	private UserDao userDao;

	public boolean login(UserDto userDto) {	
		if (userDto != null) {
			User user = new User();
			BeanUtils.copyProperties(userDto, user);
			List<User> list = userDao.findNameAndPass(user);
			if (list.size() == 1) {
				BeanUtils.copyProperties(list.get(0), userDto);
				return true;
			}
			return false;
		}
		return false;
	}

	
	
	
}
